<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/inputstyle.css" />
<title>学生成绩列表</title>
<style type="text/css">
<!--
.STYLE12 {font-family: "微软雅黑"}
-->
</style>
</head>

<head><style>
body{background:url(2.jpg) top left;
background-size:100%;}
</style></head>

<style type="text/css">
table.hovertable {
    font-family: verdana,arial,sans-serif;
    font-size:11px;
    color:#333333;
    border-width: 1px;
    border-color: #999999;
    border-collapse: collapse;
}
table.hovertable th {
    background-color:#c3dde0;
    border-width: 1px;
    padding: 8px;
    border-style: solid;
    border-color: #a9c6c9;
}
table.hovertable tr {
    background-color:#d4e3e5;
}
table.hovertable td {
    border-width: 1px;
    padding: 8px;
    border-style: solid;
    border-color: #a9c6c9;
}
.STYLE1 {
	font-size: 14pt;
	color: #FF9900;
	font-family: "微软雅黑";
}
.STYLE4 {font-size: 36px}
.STYLE5 {font-size: 24px}
.STYLE6 {font-size: 16px}
.STYLE10 {font-size: 14px; font-weight: bold; font-family: "微软雅黑"; }
.STYLE11 {font-family: "微软雅黑"; font-size: 12pt;}


</style>


<%
//连接MySQL数据库
//1、装在MySQL数据库的驱动程序
// "com.mysql.jdbc.Driver"---mysql-connector-java-5.1.30-bin.jar文件
Class.forName("com.mysql.jdbc.Driver").newInstance();
//2、MySQL的URL地址
//jdbc：说明采用JDBC的方式来访问数据库
//mysql：说明连接的是MYSQL数据库
//127.0.0.1：数据库所在的服务器的网络地址
//3306：mysql默认的端口号
//itcast：数据库的名称
String url="jdbc:mysql://127.0.0.1:3306/student?useUnicode=true&characterEncoding=utf8";
// 3、用户名和密码
String dbusername="root";
String dbpassword="";
Connection conn=DriverManager.getConnection(url,dbusername,dbpassword);
Statement stmt=conn.createStatement();
//T_STUDENTS

%>


<body>

<table align="center" valign="middle" width="567" height="209" border="1" class="hovertable" >

  <tr>
    <td height="65" colspan="6"><div align="center" class="STYLE1"><strong><strong> &nbsp;&nbsp;<span class="STYLE4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="STYLE5">&nbsp;学生信息列表</span></span></strong>
        <span class="STYLE5"><strong>&nbsp;</strong></span><span class="STYLE4"><strong>&nbsp;</strong></span>
        <input name="button" type="submit" class="btn_warning" id="button" onClick="javascript:window.location='main.jsp'" value="返回主页">
    </strong></div></td>
  </tr>
  <tr>
    <td width="103" height="39" ><div align="center">
      <div align="center" class="STYLE10">姓名</div>
    </div></td>
    <td width="105"><div align="center" >
      <div align="center" class="STYLE10">学号</div>
    </div></td>
    <td width="117"><div align="center" >
      <div align="center" class="STYLE10">科目</div>
    </div></td>
    <td width="78"><div align="center" >
      <div align="center" class="STYLE10">成绩</div>
    </div></td>
    <td colspan="2"><div align="center" >
      <div align="center" class="STYLE10">操作</div>
    </div></td>
  </tr>
  
  <%
  String name = "";
  name=request.getParameter("textfield");
  
  if(name==null) {name="";}
    
  String cond = "";
  name=new String(name.getBytes("iso-8859-1"),"utf-8");
  
  if(!name.equals("")){
  cond=" AND name like '%"+name+"%'";}
  
  ResultSet rs=stmt.executeQuery("SELECT * FROM information where 1=1"+cond);
  
  while(rs.next()){ 
  %>
  
  <tr onMouseOver="this.style.backgroundColor='#FFFF66';" onMouseOut="this.style.backgroundColor='#d4e3e5';">
  
    <td height="36" ><div align="center" class="STYLE12"><span class="STYLE6"><%=rs.getString("name")%></span></div></td>
    <td><div align="center" class="STYLE12"><span class="STYLE6"><%=rs.getString("number")%></span></div></td>
    <td><div align="center" class="STYLE12"><span class="STYLE6"><%=rs.getString("subject")%></span></div></td>
    <td><div align="center" class="STYLE12"><span class="STYLE6"><%=rs.getString("score")%></span></div></td>
	
	<td width="56"><div align="center" class="STYLE6 STYLE12"> 
	  <div align="center"><a href="edit.jsp?number=<%=rs.getString("number")%>"><font color="#3333FF">编辑</font></a></div>
	</div></td>
	
	<td width="68"><div align="center" class="STYLE6 STYLE12"> 
	  <div align="center"><a href="delete.jsp?number=<%=rs.getString("number")%>"><font color="#3333FF">删除</font></a></div>
	</div></td>
  </tr>
	
  <%}%>
  
  
		
  <tr>
    <td height="57" colspan="6"><form action="" method="post" name="form1" class="STYLE6" id="form1">
      <div align="center"><span class="STYLE11">请输入学生姓名：
        </span>
        <input name="textfield" type="text" size="30">
         <input name="search" type="submit" class="bgclass2" id="search" value="查询">
         <input name="add" type="button" class="bgclass" id="add" onClick="javascript:window.location='add.jsp';" value="添加">
        </div>
    </form> </td>
  </tr>
</table>

<p>&nbsp;</p>
</body>
</html>